From 511dceda6d130810690eb9ddcbe7d71dabdb0a1e Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Sun, 17 Dec 2017 09:42:57 -0700 Subject: [PATCH] allow passing of multiple possible extensions to GUI (#149) The extensions are used by GUI for filtering files to display for both input and output. The first extension is used by the gui in the output file dialog if a user doesn't supply and extension. --- gui/formatload.cc | 2 +- vecs.cc | 17 +++++------------ xmldoc/formats/gtrnctr1.xml | 1 - 3 files changed, 6 insertions(+), 14 deletions(-) delete mode 100644 xmldoc/formats/gtrnctr1.xml diff --git a/gui/formatload.cc b/gui/formatload.cc index 7142f35a1..774e3b7c1 100644 --- a/gui/formatload.cc +++ b/gui/formatload.cc @@ -108,7 +108,7 @@ bool FormatLoad::processFormat(Format &format) hfields[1][1] == QChar('w'), hfields[1][3] == QChar('w'), hfields[1][5] == QChar('w'), hfields[0] == "file", hfields[0] == "serial", - QStringList() << hfields[3], + hfields[3].split('/'), optionList, optionList2, htmlPage); if (htmlPage.length() > 0 && Format::getHtmlBase().length() == 0) { diff --git a/vecs.cc b/vecs.cc index 6ecbe5312..2edbe55e0 100644 --- a/vecs.cc +++ b/vecs.cc @@ -32,7 +32,7 @@ typedef struct { ff_vecs_t* vec; const char* name; const char* desc; - const char* extension; + const char* extensions; // list of possible extensions separated by '/', first is output default for GUI. const char* parent; } vecs_t; @@ -241,13 +241,6 @@ vecs_t vec_list[] = { "gdb", NULL, }, - { - >c_vecs, - "gtrnctr", - "Garmin Training Center (.xml)", - "xml", - NULL, - }, { &mapsend_vecs, "mapsend", @@ -663,8 +656,8 @@ vecs_t vec_list[] = { { >c_vecs, "gtrnctr", - "Garmin Training Center (.tcx)", - "xml", + "Garmin Training Center (.tcx/.crs/.hst/.xml)", + "tcx/crs/hst/xml", NULL, }, { @@ -1499,7 +1492,7 @@ sort_and_unify_vecs(int* ctp) svp[i] = (vecs_t*) xcalloc(1, sizeof** svp); svp[i]->name = svec->name; svp[i]->vec = (ff_vecs_t*) xmalloc(sizeof(*svp[i]->vec)); - svp[i]->extension = xcsv_file.extension; + svp[i]->extensions = xcsv_file.extension; *svp[i]->vec = *vec_list[0].vec; /* Interits xcsv opts */ /* Reset file type to inherit ff_type from xcsv for everything * except the xcsv format itself, which we leave as "internal" @@ -1722,7 +1715,7 @@ disp_formats(int version) disp_v2(vec->vec); } printf("%s\t%s\t%s%s%s\n", vec->name, - vec->extension? vec->extension : "", + vec->extensions? vec->extensions : "", vec->desc, version >= 3 ? "\t" : "", version >= 3 ? vec->parent : ""); diff --git a/xmldoc/formats/gtrnctr1.xml b/xmldoc/formats/gtrnctr1.xml deleted file mode 100644 index 8b1378917..000000000 --- a/xmldoc/formats/gtrnctr1.xml +++ /dev/null @@ -1 +0,0 @@ - -- 2.30.2